from pydantic import BaseModel, Field
from typing import List, Optional, Dict
from datetime import datetime


class ProductCreate(BaseModel):
    """创建产品请求模型"""
    name: str = Field(..., description="产品名称")
    

class ProductResponse(BaseModel):
    """产品信息响应模型"""
    id: str = Field(..., description="产品ID")
    name: str = Field(..., description="产品名称")
    has_analysis: bool = Field(..., description="是否有分析结果")
    image_count: int = Field(..., description="图片数量")
    created_time: float = Field(..., description="创建时间戳")
    
    
class ProductDetail(BaseModel):
    """产品详情响应模型"""
    id: str = Field(..., description="产品ID")
    name: str = Field(..., description="产品名称")
    images: List[str] = Field([], description="图片列表")
    analysis_result: Optional[str] = Field(None, description="分析结果")
    created_time: float = Field(..., description="创建时间戳")


class AnalysisResponse(BaseModel):
    """分析结果响应模型"""
    product_id: str = Field(..., description="产品ID")
    product_name: str = Field(..., description="产品名称")
    analysis_result: str = Field(..., description="分析结果")
    created_time: datetime = Field(..., description="创建时间") 


class ImageTextResponse(BaseModel):
    """图片OCR文本内容响应模型"""
    image_name: str = Field(..., description="图片名称")
    text_content: Optional[str] = Field(None, description="OCR文本内容")


class ProductImageTextsResponse(BaseModel):
    """产品所有图片OCR文本内容响应模型"""
    product_id: str = Field(..., description="产品ID") 
    product_name: str = Field(..., description="产品名称")
    image_texts: List[ImageTextResponse] = Field([], description="图片OCR文本列表") 